/******************************************************
 * Cours: LOG121
 * Session: A2012
 * Groupe: 01 Projet: Laboratoire #2
 * Étudiant(e)s: Guillaume Boulay
 *               Raphael Faucher
 * Professeur et chargé de labo : Patrice Boucher
 * Nom du fichier: TestPlayer.java
 * Date crée: 2012-11-19
 ******************************************************* 
 * Historique des modifications
 ******************************************************* 
 * 2012-11-19 Version initiale (Guillaume Boulay)
 *******************************************************/
import junit.framework.*;

public class TestPlayer extends TestCase
{
    /**
     * S'assure que la classe Player gère bien le score des joueurs.
     */
    public void testPlayerScore()
    {
        Player player = new Player();
        
        player.setScore(20);
        assertTrue(player.getScore() == 20);
        
        player.addScore(-10);
        assertTrue(player.getScore() == 10);
        
        player.addScore(-20);
        assertTrue(player.getScore() == -10);

        player = new Player();
        assertTrue(player.getScore() == 0);
    }
    
    /**
     * S'assure que la classe Player gère bien la fonction compareTo().
     */
    public void testPlayerCompareTo()
    {
        Player player = new Player();
        Player playerTwo = new Player();
        
        assertTrue(player.compareTo(playerTwo) == 0);
        
        player.setScore(20);
        assertTrue(player.compareTo(playerTwo) > 0);
        
        player.setScore(-20);
        assertTrue(player.compareTo(playerTwo) < 0);
    }
}
